<template>
  <div class="Banner6__layer"
       :style="{height: isPreview ? 'auto' : '100%', width: ((editorDevice === 'desktop' || editorDevice === 'all') &&  formData.showDevice !== 'mobile') ? '100%' : '375px', transform: ((editorDevice === 'desktop' || editorDevice === 'all') &&  formData.showDevice !== 'mobile') ? 'none': 'scale(0.8)'}"
       style="align-items: flex-start; background-color: rgba(0, 0, 0, 0.6);position: absolute;">
    <div :class="[formData.bgStyle, formData.bgAlignment]"  class="Banner6PcWrap" v-if="((editorDevice === 'desktop' || editorDevice === 'all') &&  formData.showDevice !== 'mobile')"
         :style="{background: 'url('+ formData.imageUrl +') no-repeat scroll '+ formData.baseMap1}">
      <b v-html="formData.reductionTextBefore"></b> <b v-html="formData.reductionTextAfter"></b>
    </div>
    <div :class="[formData.bgStyle, formData.bgAlignment]"  class="Banner6MobileWrap"  v-if="editorDevice === 'mobile' || formData.showDevice === 'mobile'"
         :style="{background: 'url('+ formData.imageUrl +') no-repeat scroll '+ formData.baseMap1}">
      <b v-html="formData.reductionTextBefore"></b> <b  v-html="formData.reductionTextAfter"></b>
    </div>
  </div>
</template>

<script>
import {mapGetters} from 'vuex';
export default {
    name: 'BulletinBoardCountDown',
    props: {
        formData: {
            type: Object,
            default: () => ({})
        },
        deviceName: {
            type: String,
            default: 'desktop'
        },
        isPreview: {
            type: Boolean,
            default: false
        }
    },
    watch: {
        deviceName (newValue) {
            this.editorDevice = newValue;
        },
        editor (newValue) {
            this.editorDevice = newValue;
        }
    },
    data () {
        return {
            editorDevice: 'all'
        };
    },
    computed: {
        ...mapGetters({editor: 'editorDevice'})
    },
    methods: {
        getTimeStr (time) {
            if (time < 10) {
                return '0' + time;
            }
            return time;
        }
    }
};
</script>

<style lang="scss" scoped>
.Banner6__layer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;

  .Banner6PcWrap {
    position: absolute;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    line-height: 1.2;
    color: #000;
    text-align: center;
  }
  .Banner6MobileWrap{
    position: absolute;
    padding: 14px;
    width: 375px;
    text-align: center;
    line-height: 1.2;
    color: #000;
  }
}
</style>

<style lang="scss">
.Template6__btn {
  p {
    margin: 0;
  }
}
.Banner6MobileWrap{
  p{
    margin-top: 0;
    margin-bottom: 6px;
  }

}
.bg-selfAdaption {
  background-repeat: no-repeat!important;
  background-size: auto 100% !important;
}
.bg-fill {
  background-repeat: repeat!important;
  background-size: 100% auto !important;
}
.bg-stretching {
  background-repeat: repeat!important;
  background-size: 100% 100% !important;
}
.bg-tile {
  background-repeat: repeat!important;
  background-size: auto !important;
}
.bg-center {
  background-position: center center !important;
}
.bg-left-top {
  background-position: left top !important;
}
.bg-right-top {
  background-position: right top !important;
}
.bg-left-bottom {
  background-position: left bottom !important;
}
.bg-right-bottom {
  background-position: right bottom !important;
}
</style>
